<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/cms/include/init_admin.jsp" %>
<%@ page import="com.qbooks.cms.product.*" %>
<%
	HashList code001		= CommonUtil.getCodeList("001", "전체");	//앱종류
	HashList code010		= CommonUtil.getCodeList("010", "전체");	//무료구분
	HashList code017		= CommonUtil.getCodeList("017", "전체");	//판매상태
	HashList codeCategory	= CommonUtil.getCodeList("category");	//카테고리

	String s_app_type		= StringUtil.nvl(request.getParameter("s_app_type"));
	String s_book_type		= StringUtil.nvl(request.getParameter("s_book_type"));
	String s_category_code	= StringUtil.nvl(request.getParameter("s_category_code"));
	String s_sales_status	= StringUtil.nvl(request.getParameter("s_sales_status"));
	
	String s_book_name		= StringUtil.nvl(request.getParameter("s_book_name"));
	String s_publisher_name	= StringUtil.nvl(request.getParameter("s_publisher_name"));
	

	HashMap infos = new HashMap();
	infos.put("app_type", 		s_app_type);
	infos.put("book_type", 		s_book_type);
	infos.put("category_code", 	s_category_code);
	infos.put("sales_status", 	s_sales_status);
	infos.put("book_name",		s_book_name);
	infos.put("publisher_name", 	s_publisher_name);

	ProductDAO dao 	= new ProductDAO();
	HashList list 	= dao.selectBookList(infos);

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title><%= SYSTEM_NAME %></title>
	<%@ include file="/cms/include/cssnjs.jsp"  %>
	<script type="text/javascript">
	$(document).ready(function() {
		$('#s_book_name').focus().select();
		$('#list').find('tr').hover(
				function () { $(this).addClass("hover"); }
			  , function () { $(this).removeClass("hover"); }
			)
			.click(function(){
				$('#book_code').val($(this).attr('book_code'));
				$('#searchForm').attr('action', './bookDetail.jsp');
				$('#searchForm').submit();
			});
		$('#list').find('input, select').change(function() {
			$(this).closest('tr').find('input[name="list.job_type"]').val('U');
		});
	});


	function fnSave() {
		$("#saveForm").attr('action', './bookSave.do');
		$("#saveForm").submit();
	}


	function fnNew() {
		$('#book_code').val('XXXXXX');
		$('#searchForm').attr('action', './bookDetail.jsp?job_type=C');
		$('#searchForm').submit();
	}
	</script>
</head>
<body>
<div id="wrap">
	<div id="top">
		<%@ include file="/cms/include/top.jsp" %>
	</div>
	<div id="page">
		<div id="menu">
			<%@ include file="/cms/include/leftMenu.jsp" %>
		</div>
		<div id="contents">
			<div class="menu_title">
				<h1>큐북관리</h1>
				<p>CMS > 상품관리 > <b>큐북관리</b></p>
			</div>
			<div class="clear line_01"></div>

			<form id="searchForm" method="post" action="./bookList.jsp">
			<input type="hidden" name="book_code" id="book_code" value=""/>

			<table cellpadding="0" cellspacing="0" class="table_01 mt15">
			<colgroup>
				<col width="100px" />
				<col width="180px" />
				<col width="100px" />
				<col width="160px" />
				<col width="100px" />
				<col  />
			</colgroup>
			<tr>
				<th><p>판매구분</p></th>
				<td>
					<select name="s_book_type" class="w120">
					<%= StringUtil.makeOption(code010, s_book_type) %>
					</select>
				</td>
				<th><p>앱종류</p></th>
				<td>
					<select name="s_app_type" class="w120">
					<%= StringUtil.makeOption(code001, s_app_type) %>
					</select>
				</td>
				<th><p>카테고리</p></th>
				<td>
					<select name="s_category_code" class="w120">
					<option value="">전체</option>
					<%= StringUtil.makeOptionByGroup(codeCategory, s_category_code) %>
					</select>
				</td>
			</tr>
			<tr>
				<th><p>큐북명</p></th>
				<td>
					<input type="text" name="s_book_name" id="s_book_name" value="<%= s_book_name %>" class="w120"/>
				</td>
				<th><p>발행자명</p></th>
				<td>
					<input type="text" name="s_publisher_name" id="s_publisher_name" value="<%= s_publisher_name %>" class="w120"/>
				</td>
				<th><p>판매상태</p></th>
				<td class="brx">
					<select name="s_sales_status" class="w100">
					<%= StringUtil.makeOption(code017, s_sales_status) %>
					</select>
				</td>
			</tr>
			</table>

			<div class="mt10 mb10 r">
				<input type="image" class="button" src="../images/btn_search.gif"/>
				<a href="#nohref" onclick="fnNew()"><img src="../images/btn_new.gif"/></a>
			</div>

			</form>




			<div class="search_result">검색결과 : <%= list.size() %>건</div>


		    <table cellpadding="0" cellspacing="0" class="table_03">
				<colgroup>
					<col width="40px"/>
					<col width="60px"/>
					<col width="120px"/>
					<col width="100px"/>
					<col />
					<col width="100px"/>
					<col width="60px"/>
					<col width="60px"/>
					<col width="60px"/>
					<col width="100px"/>
				</colgroup>
				<thead>
					<tr>
						<th><p>No</p></th>
						<th><p>구분</p></th>
						<th><p>카테고리</p></th>
						<th><p>큐북코드</p></th>
						<th><p>큐북명</p></th>
						<th><p>발행자명</p></th>
						<th><p>조회</p></th>
						<th><p>다운</p></th>
						<th><p>상태</p></th>
						<th><p>등록일</p></th>
					</tr>
				</thead>
				<tbody id="list">
			<%	for (int i = 0; i < list.size(); i++) { %>
					<tr book_code="<%= list.get("book_code", i) %>">
						<td><%= i+1 %></td>
						<td><%= list.get("book_type_name", i) %></td>
						<td><%= list.get("category_name", i) %></td>
						<td><%= list.get("book_code", i) %></td>
						<td class="l"><%= list.get("book_name", i) %></td>
						<td><%= list.get("publisher_name", i) %></td>
						<td><%= list.get("hit_count", i) %></td>
						<td><%= list.get("download_count", i) %></td>
						<td><%= list.get("sales_status", i) %></td>
						<td><%= list.get("up_date", i) %></td>
					</tr>
			<%	} %>
				</tbody>
			</table>

		</div>
	</div>
</div>
</body>
</html>
